
pkgname=tk
pkgver=8.6.8
_pkgver=8.6
pkgrel=1
pkgdesc="A windowing toolkit for use with tcl"
arch=('x86_64')
url="http://tcl.sourceforge.net/"
license=('custom')
depends=("tcl=${pkgver}" 'libxss' 'libxft')
source=("https://downloads.sourceforge.net/sourceforge/tcl/${pkgname}${pkgver}-src.tar.gz")
md5sums=('5e0faecba458ee1386078fb228d008ba')

build() {
  cd ${pkgname}${pkgver}/unix

  ./configure --prefix=/usr \
              --mandir=/usr/share/man \
              --enable-threads \
              --enable-xft \
              --enable-64bit
  
  make
  
  # LFS recommendation http://www.linuxfromscratch.org/blfs/view/svn/general/tk.html
  sed -e "s@^\(TK_SRC_DIR='\).*@\1/usr/include'@" \
      -e "/TK_B/s@='\(-L\)\?.*unix@='\1/usr/lib@" \
      -i tkConfig.sh
}

package() {
  cd ${pkgname}${pkgver}/unix
    
  make INSTALL_ROOT=${pkgdir} install install-private-headers
  ln -sf wish${_pkgver} ${pkgdir}/usr/bin/wish

  install -Dm644 license.terms ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}

